Halogen Componentのcomponent
例
code:purs(hs)
component :: forall query input output m. H.Component query input output m
component =
H.mkComponent
{ initialState
, render
, eval: H.mkEval $ H.defaultEval { handleAction = handleAction }
}
component関数
componentそのもの
H.mkComponentを使って基本的な構造を作る
H.mkComponent
3つのfieldを持つ
initialState
render
eval
型
code:purs(hs)
type ComponentSpec state query action slots input output m =
{ initialState :: input -> state
, render :: state -> HC.HTML (ComponentSlot slots m action) action
, eval :: HalogenQ query action input ~> HalogenM state action slots output m
}
eval
5つのfieldを持つ
handleAction
receve
handleQuery
initialize
finalize
code:purs(hs)
type EvalSpec state query action slots input output m =
{ handleAction :: action -> HalogenM state action slots output m Unit
, handleQuery :: forall a. query a -> HalogenM state action slots output m (Maybe a)
, receive :: input -> Maybe action
, initialize :: Maybe action
, finalize :: Maybe action
}